<html>
<head><meta charset="utf-8"><title>Listing env vars · t-compiler/const-eval · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/index.html">t-compiler/const-eval</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html">Listing env vars</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="174198947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174198947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174198947">(Aug 27 2019 at 05:59)</a>:</h4>
<p>I'm opening this topic to keep my questions about <a href="https://github.com/rust-lang/miri/issues/756" target="_blank" title="https://github.com/rust-lang/miri/issues/756">https://github.com/rust-lang/miri/issues/756</a> in the same place :P</p>



<a name="174199449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174199449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174199449">(Aug 27 2019 at 06:11)</a>:</h4>
<p>I know that the error when trying to access <code>environ</code> is created here: <a href="https://github.com/rust-lang/miri/blob/master/src/machine.rs#L251" target="_blank" title="https://github.com/rust-lang/miri/blob/master/src/machine.rs#L251">https://github.com/rust-lang/miri/blob/master/src/machine.rs#L251</a></p>



<a name="174199498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174199498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174199498">(Aug 27 2019 at 06:12)</a>:</h4>
<p>But I'm not sure how to actually write to that location before hand.</p>



<a name="174208417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174208417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174208417">(Aug 27 2019 at 08:46)</a>:</h4>
<p>you'll need to add more arguments</p>



<a name="174208436"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174208436" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174208436">(Aug 27 2019 at 08:47)</a>:</h4>
<p>where do you want to store the location?</p>



<a name="174208438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174208438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174208438">(Aug 27 2019 at 08:47)</a>:</h4>
<p><code>MemoryExtra</code>?</p>



<a name="174229240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174229240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174229240">(Aug 27 2019 at 13:36)</a>:</h4>
<blockquote>
<p>where do you want to store the location?</p>
</blockquote>
<p>"in the correct place", I think memory extra would be ok</p>



<a name="174229665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174229665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174229665">(Aug 27 2019 at 13:40)</a>:</h4>
<p>yea, then I guess add an <code>&amp;MemoryExtra</code> arg to the function</p>



<a name="174230507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174230507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174230507">(Aug 27 2019 at 13:49)</a>:</h4>
<p>Will do</p>



<a name="174372539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174372539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174372539">(Aug 28 2019 at 15:17)</a>:</h4>
<p>After some hacks here and there I was able to allocate the environment variables and the <code>environ</code> pointer as specified in <a href="http://man7.org/linux/man-pages/man7/environ.7.html" target="_blank" title="http://man7.org/linux/man-pages/man7/environ.7.html">http://man7.org/linux/man-pages/man7/environ.7.html</a> with the null at the end and everything</p>



<a name="174372636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174372636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174372636">(Aug 28 2019 at 15:18)</a>:</h4>
<p>However when I try to run this example </p>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">for</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">std</span>::<span class="n">env</span>::<span class="n">vars_os</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">println</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;{:?}&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">x</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p>i get an alignment error <a href="https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/os.rs#L440" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/os.rs#L440">here</a> </p>
<div class="codehilite"><pre><span></span>error[E0080]: Miri evaluation error: tried to access memory with alignment 1, but alignment 8 is required
   --&gt; /home/christian/Workspace/contrib/rust/src/libstd/sys/unix/os.rs:440:41
    |
440 |         while environ != ptr::null() &amp;&amp; *environ != ptr::null() {
    |                                         ^^^^^^^^ Miri evaluation error: tried to access memory with alignment 1, but alignment 8 is required
    |
    = note: inside call to `std::sys::unix::os::env` at /home/christian/Workspace/contrib/rust/src/libstd/env.rs:143:21
</pre></div>



<a name="174372932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174372932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174372932">(Aug 28 2019 at 15:21)</a>:</h4>
<p>well... <code>environ()</code> yields <code>*mut *const *const c_char</code>: <a href="https://github.com/rust-lang/rust/blob/ac21131f7859836cd3fcb39231c0162fd892d960/src/libstd/sys/unix/os.rs#L421" target="_blank" title="https://github.com/rust-lang/rust/blob/ac21131f7859836cd3fcb39231c0162fd892d960/src/libstd/sys/unix/os.rs#L421">https://github.com/rust-lang/rust/blob/ac21131f7859836cd3fcb39231c0162fd892d960/src/libstd/sys/unix/os.rs#L421</a></p>



<a name="174372947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174372947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174372947">(Aug 28 2019 at 15:21)</a>:</h4>
<p>the outer allocation containing the pointers needs to be pointer aligned</p>



<a name="174372968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174372968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174372968">(Aug 28 2019 at 15:21)</a>:</h4>
<p>wait that's three pointers?</p>



<a name="174372986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174372986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174372986">(Aug 28 2019 at 15:22)</a>:</h4>
<p>the first one points to the <code>environ</code> static</p>



<a name="174373045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373045">(Aug 28 2019 at 15:22)</a>:</h4>
<p>like <code>***char</code>?!?</p>



<a name="174373056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373056">(Aug 28 2019 at 15:22)</a>:</h4>
<p>essentially</p>



<a name="174373064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373064">(Aug 28 2019 at 15:22)</a>:</h4>
<p>oh shit</p>



<a name="174373076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373076">(Aug 28 2019 at 15:22)</a>:</h4>
<p>I stopped at two pointers</p>



<a name="174373079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373079">(Aug 28 2019 at 15:22)</a>:</h4>
<p>ty I'll fix it</p>



<a name="174373087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373087">(Aug 28 2019 at 15:22)</a>:</h4>
<p>the <code>environ</code> static is a <code>Vec&lt;String&gt;</code> essentially</p>



<a name="174373096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373096">(Aug 28 2019 at 15:22)</a>:</h4>
<p>uh</p>



<a name="174373097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373097">(Aug 28 2019 at 15:22)</a>:</h4>
<p>wiat</p>



<a name="174373111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373111">(Aug 28 2019 at 15:22)</a>:</h4>
<p>yes</p>



<a name="174373114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373114">(Aug 28 2019 at 15:22)</a>:</h4>
<p><code>environ</code>'s type is just <code>**char</code></p>



<a name="174373132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373132">(Aug 28 2019 at 15:23)</a>:</h4>
<p>yes that's what I thought</p>



<a name="174373171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373171">(Aug 28 2019 at 15:23)</a>:</h4>
<p>but the alignment needs to be pointer-alignment</p>



<a name="174373182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373182">(Aug 28 2019 at 15:23)</a>:</h4>
<p>because the <code>environ</code> var contains pointers</p>



<a name="174373198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373198">(Aug 28 2019 at 15:24)</a>:</h4>
<p>only what is being pointed at may be <code>u8</code> aligned</p>



<a name="174373294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373294">(Aug 28 2019 at 15:24)</a>:</h4>
<p>are you taking into account that before the line that errors they already did <code>let environ = *environ</code>?</p>



<a name="174373381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373381">(Aug 28 2019 at 15:25)</a>:</h4>
<p>so <code>environ</code> should be <code>*char</code> and <code>*environ</code> should be <code>char</code> which has 1 byte alignment i think</p>



<a name="174373497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373497">(Aug 28 2019 at 15:26)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/os.rs#L438" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/os.rs#L438">https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/os.rs#L438</a></p>



<a name="174373601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174373601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174373601">(Aug 28 2019 at 15:27)</a>:</h4>
<blockquote>
<p>well... <code>environ()</code> yields <code>*mut *const *const c_char</code>: <a href="https://github.com/rust-lang/rust/blob/ac21131f7859836cd3fcb39231c0162fd892d960/src/libstd/sys/unix/os.rs#L421" target="_blank" title="https://github.com/rust-lang/rust/blob/ac21131f7859836cd3fcb39231c0162fd892d960/src/libstd/sys/unix/os.rs#L421">https://github.com/rust-lang/rust/blob/ac21131f7859836cd3fcb39231c0162fd892d960/src/libstd/sys/unix/os.rs#L421</a></p>
</blockquote>
<p>but this would mean I have to alloc a pointer to my current <code>environ</code> that is just a <code>**char</code>, is that right?</p>



<a name="174376137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174376137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174376137">(Aug 28 2019 at 15:52)</a>:</h4>
<p>uh</p>



<a name="174376140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174376140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174376140">(Aug 28 2019 at 15:52)</a>:</h4>
<p>I'm confused</p>



<a name="174376213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174376213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174376213">(Aug 28 2019 at 15:54)</a>:</h4>
<p>so <code>environ</code> is an allocation containing an array of pointers pointing to allocations of null terminated strings</p>



<a name="174376373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174376373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174376373">(Aug 28 2019 at 15:55)</a>:</h4>
<p>yes</p>



<a name="174376854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174376854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174376854">(Aug 28 2019 at 16:00)</a>:</h4>
<p>and that array of pointers is also null terminated</p>



<a name="174376874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174376874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174376874">(Aug 28 2019 at 16:00)</a>:</h4>
<p>yes but it's the wrong alignment</p>



<a name="174376891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174376891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174376891">(Aug 28 2019 at 16:00)</a>:</h4>
<p>I made it work</p>



<a name="174376895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174376895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174376895">(Aug 28 2019 at 16:00)</a>:</h4>
<p>you were right</p>



<a name="174376896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174376896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174376896">(Aug 28 2019 at 16:00)</a>:</h4>
<p>XD</p>



<a name="174376898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174376898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174376898">(Aug 28 2019 at 16:00)</a>:</h4>
<p>I need a third pointer</p>



<a name="174376899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174376899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174376899">(Aug 28 2019 at 16:00)</a>:</h4>
<p>:P</p>



<a name="174376902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174376902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174376902">(Aug 28 2019 at 16:00)</a>:</h4>
<p>needed*</p>



<a name="174376910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174376910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174376910">(Aug 28 2019 at 16:00)</a>:</h4>
<p>uh</p>



<a name="174376943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174376943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174376943">(Aug 28 2019 at 16:01)</a>:</h4>
<p>why? IDK</p>



<a name="174376948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174376948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174376948">(Aug 28 2019 at 16:01)</a>:</h4>
<p>but it worked</p>



<a name="174377222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174377222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174377222">(Aug 28 2019 at 16:03)</a>:</h4>
<p>but in fact that makes things easier</p>



<a name="174377288"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174377288" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174377288">(Aug 28 2019 at 16:04)</a>:</h4>
<p>The good thing is that now I know what other changes I need to write it properly</p>



<a name="174377349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174377349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174377349">(Aug 28 2019 at 16:05)</a>:</h4>
<p><a href="/user_uploads/4715/h95cdR2ra0EnjsusO2EeD146/Screenshot-from-2019-08-28-11-04-47.png" target="_blank" title="Screenshot-from-2019-08-28-11-04-47.png">Screenshot-from-2019-08-28-11-04-47.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/h95cdR2ra0EnjsusO2EeD146/Screenshot-from-2019-08-28-11-04-47.png" target="_blank" title="Screenshot-from-2019-08-28-11-04-47.png"><img src="/user_uploads/4715/h95cdR2ra0EnjsusO2EeD146/Screenshot-from-2019-08-28-11-04-47.png"></a></div>



<a name="174377642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174377642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174377642">(Aug 28 2019 at 16:09)</a>:</h4>
<p>I had to disable stacked borrows to make it work because <code>find_foreign_static</code> returns an <code>Allocation&lt;(),()&gt;</code></p>



<a name="174378233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174378233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174378233">(Aug 28 2019 at 16:15)</a>:</h4>
<p>can you add more details? Not sure why stacked borrows needs to be disabled for this</p>



<a name="174378274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174378274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174378274">(Aug 28 2019 at 16:15)</a>:</h4>
<p>oh, it's hardcoded to those generic params?</p>



<a name="174378324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174378324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174378324">(Aug 28 2019 at 16:16)</a>:</h4>
<p>I guess you need to fiddle through the appropriate params</p>



<a name="174378325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174378325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174378325">(Aug 28 2019 at 16:16)</a>:</h4>
<p>yes</p>



<a name="174378335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174378335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174378335">(Aug 28 2019 at 16:16)</a>:</h4>
<p>well  not harcoded</p>



<a name="174378343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174378343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174378343">(Aug 28 2019 at 16:16)</a>:</h4>
<p>those are the default for <code>Allocation</code></p>



<a name="174378350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174378350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174378350">(Aug 28 2019 at 16:16)</a>:</h4>
<p>yea</p>



<a name="174378357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174378357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174378357">(Aug 28 2019 at 16:16)</a>:</h4>
<p>but like you need to change rustc</p>



<a name="174378358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174378358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174378358">(Aug 28 2019 at 16:16)</a>:</h4>
<p><code>Allocation&lt;Tag = (), Extra =()&gt;</code></p>



<a name="174378373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174378373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174378373">(Aug 28 2019 at 16:16)</a>:</h4>
<p>Yes yes</p>



<a name="174378390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174378390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174378390">(Aug 28 2019 at 16:17)</a>:</h4>
<p>No way I'm going to push this code, Ralf would kill me, it is horrible hahahah</p>



<a name="174382567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174382567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174382567">(Aug 28 2019 at 17:10)</a>:</h4>
<p>XD</p>



<a name="174382587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174382587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174382587">(Aug 28 2019 at 17:11)</a>:</h4>
<p>Ralf driven development</p>



<a name="174390500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174390500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174390500">(Aug 28 2019 at 18:48)</a>:</h4>
<p>Let me show you some of my magic:</p>
<div class="codehilite"><pre><span></span><span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">alloc</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">memory_extra</span><span class="p">.</span><span class="n">env_alloc</span><span class="p">.</span><span class="n">as_ref</span><span class="p">().</span><span class="n">unwrap</span><span class="p">().</span><span class="n">clone</span><span class="p">();</span><span class="w"></span>
<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">alloc</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Allocation</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                        </span><span class="n">bytes</span>: <span class="nc">alloc</span><span class="p">.</span><span class="n">bytes</span><span class="p">,</span><span class="w"></span>
<span class="w">                        </span><span class="n">relocations</span>: <span class="nc">Relocations</span>::<span class="n">from_presorted</span><span class="p">(</span><span class="n">alloc</span><span class="p">.</span><span class="n">relocations</span><span class="p">.</span><span class="n">iter</span><span class="p">().</span><span class="n">map</span><span class="p">(</span><span class="o">|</span><span class="p">(</span><span class="n">s</span><span class="p">,</span><span class="w"> </span><span class="p">(</span><span class="n">_</span><span class="p">,</span><span class="w"> </span><span class="n">i</span><span class="p">))</span><span class="o">|</span><span class="w"> </span><span class="p">(</span><span class="o">*</span><span class="n">s</span><span class="p">,</span><span class="w"> </span><span class="p">((),</span><span class="w"> </span><span class="o">*</span><span class="n">i</span><span class="p">))).</span><span class="n">collect</span>::<span class="o">&lt;</span><span class="nb">Vec</span><span class="o">&lt;</span><span class="n">_</span><span class="o">&gt;&gt;</span><span class="p">()),</span><span class="w"></span>
<span class="w">                        </span><span class="n">undef_mask</span>: <span class="nc">alloc</span><span class="p">.</span><span class="n">undef_mask</span><span class="p">,</span><span class="w"></span>
<span class="w">                        </span><span class="n">align</span>: <span class="nc">alloc</span><span class="p">.</span><span class="n">align</span><span class="p">,</span><span class="w"></span>
<span class="w">                        </span><span class="n">mutability</span>: <span class="nc">alloc</span><span class="p">.</span><span class="n">mutability</span><span class="p">,</span><span class="w"></span>
<span class="w">                        </span><span class="n">extra</span>: <span class="p">()</span><span class="w"></span>
<span class="w">                    </span><span class="p">};</span><span class="w"></span>
<span class="w">                </span><span class="n">alloc</span><span class="w"></span>
</pre></div>



<a name="174390547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174390547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174390547">(Aug 28 2019 at 18:48)</a>:</h4>
<p>Untaging Done Wrong™</p>



<a name="174390958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174390958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174390958">(Aug 28 2019 at 18:53)</a>:</h4>
<p><span aria-label="no entry" class="emoji emoji-26d4" role="img" title="no entry">:no_entry:</span></p>



<a name="174391118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174391118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174391118">(Aug 28 2019 at 18:55)</a>:</h4>
<p>Solving this tagging thing is driving me nuts.</p>



<a name="174391504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174391504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174391504">(Aug 28 2019 at 18:58)</a>:</h4>
<p>So, the output of <code>Machine::find_foreign_static</code> is tagged in <code>Memory::get_static_alloc</code>. I changed <code>get_static_alloc</code> inside rust so it doesn't tag the output of <code>find_foreign_static</code>. But now I need to tag <a href="https://github.com/rust-lang/miri/blob/master/src/machine.rs#L256" target="_blank" title="https://github.com/rust-lang/miri/blob/master/src/machine.rs#L256">this</a> allocation inside miri. Any ideas?</p>



<a name="174393407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174393407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174393407">(Aug 28 2019 at 19:22)</a>:</h4>
<p>Uh... call tag_allocation ?</p>



<a name="174393430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174393430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174393430">(Aug 28 2019 at 19:22)</a>:</h4>
<p>Not sure if all info is available to do so</p>



<a name="174393704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174393704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174393704">(Aug 28 2019 at 19:26)</a>:</h4>
<p>Nope I dont have an alloc_id</p>



<a name="174393719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174393719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174393719">(Aug 28 2019 at 19:26)</a>:</h4>
<p>But I think I can leave it untagged, let me see</p>



<a name="174393740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174393740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174393740">(Aug 28 2019 at 19:26)</a>:</h4>
<p>I mean, tagged with <code>Tag::Untagged</code></p>



<a name="174394683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174394683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174394683">(Aug 28 2019 at 19:38)</a>:</h4>
<p>Oh lol, the problem is not the tagging, is the extra</p>



<a name="174395657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174395657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174395657">(Aug 28 2019 at 19:50)</a>:</h4>
<p>Ah, that impls Default I think</p>



<a name="174395675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174395675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174395675">(Aug 28 2019 at 19:50)</a>:</h4>
<p>So just call Default::default()</p>



<a name="174395850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174395850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174395850">(Aug 28 2019 at 19:53)</a>:</h4>
<p>At the end the thing is that I have an <code>Allocation&lt;Tag, ()&gt;</code> and I need an <code>Allocation&lt;Tag, AllocExtra&gt;</code> but I wanted to add the <code>alloc_extra</code> with a method instead of destructuring the allocation itself D:</p>



<a name="174396109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174396109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174396109">(Aug 28 2019 at 19:57)</a>:</h4>
<p>I could do that by changing the <code>Allocation</code> impl</p>



<a name="174397361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174397361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174397361">(Aug 28 2019 at 20:15)</a>:</h4>
<p>Add a <code>map_extra</code> method</p>



<a name="174397423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174397423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174397423">(Aug 28 2019 at 20:16)</a>:</h4>
<p>(deleted)</p>



<a name="174397479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174397479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174397479">(Aug 28 2019 at 20:17)</a>:</h4>
<p>I was thinking about changing <a href="https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc/mir/interpret/allocation.rs.html#84" target="_blank" title="https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc/mir/interpret/allocation.rs.html#84">https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc/mir/interpret/allocation.rs.html#84</a> for</p>
<div class="codehilite"><pre><span></span><span class="k">impl</span><span class="o">&lt;</span><span class="n">Tag</span><span class="p">,</span><span class="w"> </span><span class="n">Extra</span>: <span class="nb">Default</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Allocation</span><span class="o">&lt;</span><span class="n">Tag</span><span class="p">,</span><span class="w"> </span><span class="n">Extra</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">..</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="174397487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174397487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174397487">(Aug 28 2019 at 20:17)</a>:</h4>
<p>but if you think the method is better I will</p>



<a name="174397855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174397855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174397855">(Aug 28 2019 at 20:22)</a>:</h4>
<p>Oh heh</p>



<a name="174397860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174397860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174397860">(Aug 28 2019 at 20:22)</a>:</h4>
<p>Go right ahead</p>



<a name="174398153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174398153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174398153">(Aug 28 2019 at 20:26)</a>:</h4>
<p>Uff...</p>



<a name="174398158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174398158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174398158">(Aug 28 2019 at 20:26)</a>:</h4>
<p>it seems I broke something with all the tagging</p>



<a name="174398222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174398222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174398222">(Aug 28 2019 at 20:27)</a>:</h4>
<div class="codehilite"><pre><span></span>error[E0080]: Miri evaluation error: no item granting write access to tag &lt;17&gt; found in borrow stack
   --&gt; /home/christian/Workspace/contrib/rust/src/libstd/sys/unix/thread.rs:307:9
    |
307 |         PAGE_SIZE = os::page_size();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Miri evaluation error: no item granting write access to tag &lt;17&gt; found in borrow stack
    |
    = note: inside call to `std::sys::unix::thread::guard::init` at /home/christian/Workspace/contrib/rust/src/libstd/rt.rs:33:26
    = note: inside call to `std::rt::lang_start_internal` at /home/christian/Workspace/contrib/rust/src/libstd/rt.rs:64:5
    = note: inside call to `std::rt::lang_start::&lt;()&gt;`
</pre></div>



<a name="174398228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174398228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174398228">(Aug 28 2019 at 20:27)</a>:</h4>
<p>:D</p>



<a name="174398365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174398365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174398365">(Aug 28 2019 at 20:29)</a>:</h4>
<p>It seems I need to properly tag the statics in miri</p>



<a name="174428009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174428009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174428009">(Aug 29 2019 at 06:38)</a>:</h4>
<blockquote>
<p>so <code>environ</code> is an allocation containing an array of pointers pointing to allocations of null terminated strings</p>
</blockquote>
<p>no, environ is a ptr-sized allocation containing a pointer to an allocation containing a null-terminated array of pointers to null-terminated strings.</p>



<a name="174428024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174428024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174428024">(Aug 29 2019 at 06:38)</a>:</h4>
<p>and that array of pointers is also null-terminated</p>



<a name="174428032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174428032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174428032">(Aug 29 2019 at 06:39)</a>:</h4>
<p>indeed</p>



<a name="174428107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174428107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174428107">(Aug 29 2019 at 06:40)</a>:</h4>
<p>also see <a href="https://github.com/rust-lang/rust/pull/63951#issuecomment-525921663" target="_blank" title="https://github.com/rust-lang/rust/pull/63951#issuecomment-525921663">https://github.com/rust-lang/rust/pull/63951#issuecomment-525921663</a></p>



<a name="174428147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174428147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174428147">(Aug 29 2019 at 06:41)</a>:</h4>
<p>I just don't like the laziness aspect of that very much... the static should always exist, not just when it is used the first time</p>



<a name="174428154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174428154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174428154">(Aug 29 2019 at 06:41)</a>:</h4>
<p>the trouble is that unlike the other statics we handle lazily, this one actually changes^^</p>



<a name="174429020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174429020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174429020">(Aug 29 2019 at 07:01)</a>:</h4>
<p>Too many pointers...</p>



<a name="174429048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174429048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174429048">(Aug 29 2019 at 07:02)</a>:</h4>
<p>Maybe we need a Serializer impl for Memory so we can use serde to just make rust datastructures become const memory</p>



<a name="174429886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174429886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174429886">(Aug 29 2019 at 07:18)</a>:</h4>
<p>lol</p>



<a name="174434167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174434167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174434167">(Aug 29 2019 at 08:35)</a>:</h4>
<p>Well idk I made it work but I had to disable like half of the stacked borrows check to do so</p>



<a name="174434296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174434296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174434296">(Aug 29 2019 at 08:37)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span>, your suggestion of adding the <code>AllocId</code> to <code>find_foreign_static</code>should be enough to solve the stacked borrows conflicts?</p>



<a name="174471521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174471521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174471521">(Aug 29 2019 at 16:53)</a>:</h4>
<p>it worked <span aria-label="party ball" class="emoji emoji-1f38a" role="img" title="party ball">:party_ball:</span> <span aria-label="party ball" class="emoji emoji-1f38a" role="img" title="party ball">:party_ball:</span></p>



<a name="174471594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174471594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174471594">(Aug 29 2019 at 16:54)</a>:</h4>
<blockquote>
<p>it worked <span aria-label="party ball" class="emoji emoji-1f38a" role="img" title="party ball">:party_ball:</span> <span aria-label="party ball" class="emoji emoji-1f38a" role="img" title="party ball">:party_ball:</span></p>
</blockquote>
<p>awesome :D</p>



<a name="174471604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174471604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174471604">(Aug 29 2019 at 16:54)</a>:</h4>
<p>let me fix the docs</p>



<a name="174471858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174471858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174471858">(Aug 29 2019 at 16:58)</a>:</h4>
<p>Oh wait, it actually didnt :(</p>



<a name="174471876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174471876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174471876">(Aug 29 2019 at 16:58)</a>:</h4>
<p>I ran the wrong file with miri D:</p>



<a name="174472072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174472072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174472072">(Aug 29 2019 at 17:00)</a>:</h4>
<div class="codehilite"><pre><span></span>error[E0080]: Miri evaluation error: trying to reborrow for Unique, but parent tag &lt;1363&gt; does not have an appropriate item in the borrow stack
   --&gt; /home/christian/Workspace/contrib/rust/src/libstd/sys/unix/os.rs:423:5
    |
423 |     &amp;mut environ
    |     ^^^^^^^^^^^^ Miri evaluation error: trying to reborrow for Unique, but parent tag &lt;1363&gt; does not have an appropriate item in the borrow stack
    |
    = note: inside call to `std::sys::unix::os::environ` at /home/christian/Workspace/contrib/rust/src/libstd/sys/unix/os.rs:438:28
    = note: inside call to `std::sys::unix::os::env` at /home/christian/Workspace/contrib/rust/src/libstd/env.rs:143:21
</pre></div>



<a name="174472473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174472473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174472473">(Aug 29 2019 at 17:06)</a>:</h4>
<p>I think I'm going to read <span class="user-mention" data-user-id="120791">@RalfJ</span>'s blog before trying to change more stuff</p>



<a name="174472613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174472613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174472613">(Aug 29 2019 at 17:07)</a>:</h4>
<p>Should I commit the changes adding the <code>AllocId</code> to <code>find_foreign_static</code>?</p>



<a name="174478367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174478367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174478367">(Aug 29 2019 at 18:12)</a>:</h4>
<blockquote>
<p>I think I'm going to read <span class="user-mention silent" data-user-id="120791">RalfJ</span>'s blog before trying to change more stuff</p>
</blockquote>
<p>I dont think that'll help</p>



<a name="174478384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174478384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174478384">(Aug 29 2019 at 18:12)</a>:</h4>
<p>you are not doing crazy aliasing here, you are just not tracking the pointer povenance properly <em>somewhere</em></p>



<a name="174479353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174479353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174479353">(Aug 29 2019 at 18:23)</a>:</h4>
<p>I'm doing the allocations in the same way as for <code>argv</code> but using <code>MemoryKind::Env</code> instead</p>



<a name="174484728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174484728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174484728">(Aug 29 2019 at 19:29)</a>:</h4>
<p>Any Ideas on how can I debug this in a better way?</p>



<a name="174487335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174487335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174487335">(Aug 29 2019 at 20:02)</a>:</h4>
<p>Can you upload the code? Hard to make guesses in a blackbox manner</p>



<a name="174487354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174487354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174487354">(Aug 29 2019 at 20:02)</a>:</h4>
<p>Sure</p>



<a name="174487531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Listing%20env%20vars/near/174487531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Listing.20env.20vars.html#174487531">(Aug 29 2019 at 20:04)</a>:</h4>
<p><a href="https://github.com/christianpoveda/miri/commit/529af9b6333b7c0403cc1fb88bc3772729fc09f1" target="_blank" title="https://github.com/christianpoveda/miri/commit/529af9b6333b7c0403cc1fb88bc3772729fc09f1">https://github.com/christianpoveda/miri/commit/529af9b6333b7c0403cc1fb88bc3772729fc09f1</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>